﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SMS.DAL;
using SMS.DAL.Providers;

namespace SMS.Business.Stocks
{
    public class StocksBusiness : BusinessBase<Stock, StockSearchCriteria>
    {
        private StockProvider provider;
        private StockUsersProvider stockUsersProvider;

        public StocksBusiness()
        {
            provider = new StockProvider();
            stockUsersProvider = new StockUsersProvider();
        }



        public override bool Insert(Stock item)
        {
            provider.Insert(item);
            return true;
        }

        public override bool Update(Stock updatedItem)
        {
            provider.Update(updatedItem);
            return true;
        }

        public override bool Delete(int id)
        {
            provider.Delete(id);
            return true;
        }


        public override Stock GetByID(int id)
        {
            return provider.GetByID(id);
        }

        public override List<Stock> Search(StockSearchCriteria SearchCriteria)
        {
            return provider.Search(SearchCriteria);
        }

        public List<Stock> GetByUserID(StockUserSearchCriteria stockUserSearch)
        {
            return stockUsersProvider.GetStocksByUserID(stockUserSearch);
        }
    }
}
